<template>
	<view class="content">
		<!-- danger -->
		<view class="danger-box">
			<view class="danger-item" v-for="(item,index) in list" :key="index" @tap="checkDanger(item.id)">
				<view class="safe">
					<image src="/static/aqy.png" mode=""></image>用户：{{item.realname}}
				</view>
				<view>预约编号：{{item.no}}</view>
				<view>预约日期：{{item.time}}</view>
				<view>预约事项：{{item.category_name}}</view>
				<view>地<text class="kong"></text>址：{{item.address}}</view>
				<view>预约状态：
					<template v-if="item.examine_status==0">
						待审核
					</template>
					<template v-if="item.examine_status==1">
						审核通过
					</template>
					<template v-if="item.examine_status==2">
						审核未通过
					</template>
				</view>
				<view>处理状态：
					<template v-if="item.is_handel==0">
						未处理
					</template>
					<template v-if="item.is_handel==1">
						已处理
					</template>
				</view>
				<template v-if="item.examine_status==1">
					<view>处理员工：{{item.handel_name}}</view>
					<view>员工工号：{{item.staff_num}}</view>
				</template>
				
				<template v-if="item.is_handel==1&&item.is_pay!=0">
					<view>收费状态：
						<template v-if="item.is_pay==1">
							待付款
						</template>
						<template v-if="item.is_pay==2">
							已付款
						</template>
					</view>
				</template>
				<text class="chaoshi_zhuantai" v-if="item.is_handel===0&&item.exceed_time === true">已超时</text>
				<!-- <image class="shenhe" :src="item.status_picture" mode=""></image> -->
			</view>
			<view v-if="list.length==0">
				<u-empty  text="暂无预约信息"  mode="list"></u-empty>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				list:[],
				totwn:'',
				page:1
			};
		},
		onShow() {
			this.page = 1
			this.list = []
			this.getInstallDetail()
		},
		onLoad() {

		},
		//下拉刷新
		onPullDownRefresh() {
			this.page = 1
			setTimeout(function() {
				uni.stopPullDownRefresh();
			}, 500);
			this.getInstallDetail()
		},
		onReachBottom() {
			if (this.page >= this.totwn) {
				uni.showToast({
					title: '没有更多数据',
					icon: 'none'
				})
				return
			} else {
				this.page++
				this.getInstallDetail()
			}

		},
		methods: {
			checkDanger(id) {
				this.$navTo('/pages/yuyuelist/detail?id='+id)
			},
			// 获取安装数据
			getInstallDetail() {
				let that = this
				// uni.showLoading({uni.hideLoading()
				// 	title:'查询中'
				// })
				uni.request({
					url: this.$api + 'yuyue/getMemberYuyueLists',
					method: 'POST',
					header: {
						token: uni.getStorageSync('token'),
						'content-type': 'application/x-www-form-urlencoded'
					},
					data: {
						page: that.page
					},
					success: (res) => {
						if (res.data.code == 1) {
							that.totwn = res.data.data.page_count
							that.list = that.list.concat(res.data.data)
						} else {
							that.$showToast(res.data.msg)
						}
					}
				})
			},
		},

	}
</script>

<style lang="scss" scoped>
	.danger-box{
		padding-top: 30rpx;
	}
	.content {
		padding-bottom: 140rpx;
		background: #F1F1F1;
		min-height: 100vh;
	}

	.header {
		display: flex;
		justify-content: space-between;
		align-items: center;
		box-sizing: border-box;
		height: 80rpx;
		width: 100%;
		background-color: #003690;
		padding: 0 40rpx;

		.ipt-box {
			display: flex;
			justify-content: space-between;
			align-items: center;
			box-sizing: border-box;
			padding: 0 20rpx;
			width: 514rpx;
			height: 52rpx;
			background-color: #fff;
			border-radius: 28rpx;

			input {
				width: 85%;
			}

			image {
				width: 32rpx;
				height: 32rpx;
			}
		}

		.header-right {
			display: flex;
			align-items: center;
			font-size: 32rpx;
			color: #E2ECFB;
			position: relative;

			image {
				width: 36rpx;
				height: 36rpx;
			}

			.genFle {
				position: absolute;
				top: 64rpx;
				left: 0;
				width: 100%;
				background-color: #fff;
				border: 2rpx solid #ccc;
				color: #003690;
				text-align: center;
				z-index: 999;

				view {
					border-bottom: 2rpx solid #ccc;
					line-height: 60rpx;
				}
			}
		}
	}

	.test-code:active {
		background: rgba(69, 82, 202, 0.4);
		color: #fff;
	}

	.plac-class {
		font-size: 32rpx;
		color: #999;
	}

	// nav
	.nav {
		width: 100%;
		height: 80rpx;
		background-color: #fff;

		.nav-box {
			display: flex;
			justify-content: space-between;
			align-items: center;
			width: 100%;
			margin: 0 auto;
			line-height: 76rpx;
			background: #FFFFFF;
			justify-content: space-evenly;

			span {
				padding: 0 10rpx;
				font-size: 32rpx;
				color: #333;
				border-bottom: 4rpx solid transparent;
			}

			.current {
				color: #003690;
				border-bottom: 4rpx solid #003690;
			}
		}
	}

	// danger
	.danger-item {
		position: relative;
		box-sizing: border-box;
		width: 690rpx;
		padding: 30rpx;
		background-color: #fff;
		border-radius: 10rpx;
		margin: 0rpx auto 30rpx;
		box-shadow: 0px 3px 4px rgba(0, 30, 57, 0.15);
		
		view{
			margin-top: 10rpx;
		}
		.safe {
			color: #003690;
			font-size: 28rpx;
			line-height: 38rpx;

			image {
				width: 36rpx;
				height: 36rpx;
				margin-right: 6rpx;
				vertical-align: bottom;
			}
		}

		.kong {
			display: inline-block;
			width: 56rpx;
		}

		.kong1 {
			display: inline-block;
			width: 29rpx;
		}

		.chaoshi_zhuantai {
			position: absolute;
			top: 20rpx;
			right: 20rpx;
			color: red;
			font-size: 28rpx;
			line-height: 38rpx;
		}

		.shenhe {
			position: absolute;
			top: 100rpx;
			right: 20rpx;
			width: 170rpx;
			height: 170rpx;
		}
	}
</style>
